import {
  formatDate,formatDateReal
} from '../../../utils/conmon'
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    switchList:[
      {title:'已提交',dataList:[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]},
      {title:'未提交',dataList:[{},{},{},{},{},{},{},{},{},{},{}]},
    ],
    selectIndex:0,
    needLine:true,
    isShowDetail:true,
    isEdit:0,
    ifEdit:false,
    imgDetailPics:[],
    countPic:9,//上传图片最大数量
    showImgUrl: "", //路径拼接，一般上传返回的都是文件名，
    uploadImgUrl:'',//图片的上传的路径
    //imgDetailPics:[],
    dataDetail:{
      afterClock:1,//是否能补卡 0否 1是
      classId:'', //班级id 
      describes:'',//任务描叙
      endTime:'', // 结束时间
      images:[],//任务图片
      ruleJson:{
        type:1,
        week:[]
      },
      startTime:'',//开始时间
      subType:'1',//任务类型
      title:'',//任务标题

      // startTime:'', //开始时间
      
      // classType:'', //班级id 
      // describes:'', //内容
      // endTime:'', // 结束时间
      // fileUrl:'', //文件url:aaaa,bbbbb
      // loopRule:'', //规则:0只发布一次,1周内循环,2自定义
      // nj:'', //年级 
      // pictureUrl:'', //图片url:aaaa,bbbbb
      // reamrk:'1',//自定义天数:1;2;5
      // schoolId:'', //校区id 
      // sectionId:'', //学段id: 
      // submitTime:1, //提交截止天数 .
      // teacherId:'',
      // title:'',  //标题 
      // videoUrl:'', //视频url:aaaa,bbbbb
      // actionSheetHidden:true,
      // sectionId:1,
      // id:'', //作业id

    },
    actionSheetItems:[
      {value:1,txt:'1天'},
      {value:2,txt:'2天'},
      {value:3,txt:'3天'},
      {value:4,txt:'4天'},
      {value:5,txt:'5天'},
      {value:6,txt:'6天'},
      {value:7,txt:'7天'},

    ],


    cycleActionSheetItems:[
     [ {value:0,txt:'只发布一次',isSelect:true}],
     [ {value:1,txt:'周内循环'}],
     [ {value:2,txt:'自定义',list:[
       {value:1,txt:'周一',isSelect:true},
       {value:2,txt:'周二',isSelect:false},
       {value:3,txt:'周三',isSelect:false},
       {value:4,txt:'周四',isSelect:false},
       {value:5,txt:'周五',isSelect:false},
       {value:6,txt:'周六',isSelect:false},
       {value:7,txt:'周日',isSelect:false},

     ]}],
    ],

    selectCycleAction:'',//循环规则



    //班级选择----------begin
    bottom:false,
    //校区
    schoolArealist:[],
    schoolArea:'',
    schoolAreaKey:'',
    //班级类型
    classTypes: [],
    classTypesKey:'',
    //学段
    seasons:[],
    seasonKey:'',
    seasonName:'',
    //年级
    grades:[],
    gradeKey:"",
    gradeName:'',
    //班级
    classs:[],
    classKey:'',
    className:'',
    viewName:'全部班级',
    isShowDetail:true,
    //班级选择----------end
    worksTitle:'',//作业名称
    worksDesc:'',//作业内容
    
    //作业编辑
    pageData:{},

    chooseTaskMode:1,
    chooseYes:true,
    chooseNo:false,
    disabled:false,
  },

//---------------------班级选择begin
  didClickActionShow1(){
    var action =  this.selectComponent("#action-sheet1");
    action.onShowSingelAlert(this.data.schoolArealist,1);
   },

   didClickActionShow2(){
    var action =  this.selectComponent("#action-sheet2");
    action.onShowSingelAlert(this.data.grades,1);
   },

   didClickActionShow3(){
    var action =  this.selectComponent("#action-sheet3");
    action.onShowSingelAlert(this.data.classs,1);
   },

  didClickUp(){
    this.setData({
      isShowDetail:false
    })
  },
  //选择校区
  actionSheetIndex1(e){
    console.log(this.data.schoolArea+'==选择的数据='+e.detail.name)
    if(this.data.schoolArea != e.detail.name){
      this.setData({
        schoolArea:e.detail.name,
        schoolAreaKey:e.detail.key
      })
      this.getClassType(1)
    }
  },
  radioChange(res){
    console.log('选择班级的数据='+JSON.stringify(res))

    this.setData({
      classTypesKey:res.detail.value
    })
    this.getClassType(3)
  },
    //选择年级
  actionSheetIndex2(e){
    console.log(e.detail.key+'选择的数据='+e.detail.name+"==学段=="+e.detail["key-section"])
    this.setData({
      gradeName:e.detail.name,
      gradeKey:e.detail.key,
      seasonKey:e.detail["key-section"],
    })
    this.getClassType(4)
  },
  //选择班级
  actionSheetIndex3(e){

    console.log(e.detail.key+'选择的数据='+e.detail.name)
    this.setData({
      className:e.detail.name.indexOf('班')!=-1?e.detail.name:e.detail.name+"班",
      classKey:e.detail.key
    })
  },

  //获取校区
  getSchoolArea(){
    app.api.getSchoolArea().then(rest => {
      if(rest&&rest.success){   
        if(rest.data.list!=null && rest.data.list.length > 0){
           this.setData({
            schoolArealist:rest.data.list,
            schoolArea:rest.data.list[0].name,
            schoolAreaKey:rest.data.list[0].key
           })
           this.getClassType(1)
        }
        console.log('接口数据='+JSON.stringify(rest))
      }else{
        console.log('接口数据=='+rest.errMsg)
        wx.showToast({
          title: rest.errMsg||'网络异常，请稍后重试！！',
          icon: 'none',
          duration: 2000,
          mask:true
        })
      }
    })
    .catch(r => {
      console.error(r)
      wx.showToast({
        title: '网络异常，请稍后重试！',
        icon: 'none',
        duration: 2000,
        mask:true
      })
    })
  
  },


  //获取班级类型
  getClassType(resultType){
    var that = this
    var datas
    if(resultType == 1){
      datas = {
        schoolId:this.data.schoolAreaKey,
        resultType:resultType,
        pageNo:1,
        pageSize:50,
      }
    }else if(resultType == 2){
      datas = {
        schoolId:this.data.schoolAreaKey,
        resultType:resultType,
        pageNo:1,
        pageSize:50,
        type:this.data.classTypesKey,
      }
    }else if(resultType == 3){
      datas = {
        schoolId:this.data.schoolAreaKey,
        resultType:resultType,
        pageNo:1,
        pageSize:50,
        type:this.data.classTypesKey,
        section:this.data.seasonKey,
      }
    }else if(resultType == 4){
      datas = {
        schoolId:this.data.schoolAreaKey,
        resultType:resultType,
        pageNo:1,
        pageSize:50,
        type:this.data.classTypesKey,
        section:this.data.seasonKey,
        grade:this.data.gradeKey,
      }
    }
    console.log('接口参数='+JSON.stringify(datas))
    app.api.getClassInfos(datas).then(rest => {
      if(rest&&rest.success){   
        if(rest.data.list!=null && rest.data.list.length > 0){    
          console.log(resultType+'=接口数据='+JSON.stringify(rest))
          if(resultType == 1){
            this.setData({
              classTypes:rest.data.list,
             })
             this.data.classTypes[0].checked = 'true'
             this.setData({
              classTypes:rest.data.list,
              classTypesKey:rest.data.list[0].key
             })
             that.getClassType(3)
          }
          // else if(resultType == 2){
          //    this.setData({
          //     seasons:rest.data.list,
          //     seasonKey:rest.data.list[0].key,
          //     seasonName:rest.data.list[0].name,
          //    })
          //    that.getClassType(3)
          // }
          else if(resultType == 3){
            this.setData({
              grades:rest.data.list,
              gradeKey:rest.data.list[0].key,
              gradeName:rest.data.list[0].name,
              seasonKey:rest.data.list[0]["key-section"],
            })
            that.getClassType(4)
          }else if(resultType == 4){
            this.setData({
              classs:rest.data.list,
              classKey:rest.data.list[0].key,
              className:rest.data.list[0].name.indexOf('班')!=-1?rest.data.list[0].name:rest.data.list[0].name+"班",
            })
          }
        }else{
          //没有数据复位
          if(resultType == 1){
             this.setData({
              classTypes:[],
              classTypesKey:'',
              // seasons:[],
              // seasonKey:'',
              // seasonName:'',
              grades:[],
              gradeKey:'',
              gradeName:'',
              classs:[],
              classKey:'',
              className:'',
             })
          }else if(resultType == 2){
             this.setData({
              // seasons:[],
              // seasonKey:'',
              // seasonName:'',
              grades:[],
              gradeKey:'',
              gradeName:'',
              classs:[],
              classKey:'',
              className:'',
             })
            
          }else if(resultType == 3){
            this.setData({
              grades:[],
              gradeKey:'',
              gradeName:'',
              classs:[],
              classKey:'',
              className:'',
            })
           
          }else if(resultType == 4){
            this.setData({
              classs:[],
              classKey:'',
              className:'',
            })
          }
        }
       
        console.log('班级选择初始数据校区='+this.data.schoolAreaKey+"=班级类型="+this.data.classTypesKey+"=学段="+this.data.seasonKey+"=年级="+this.data.gradeKey+"=班级="+this.data.classKey)
      }else{
        console.log('接口数据=='+rest.errMsg)
        wx.showToast({
          title: rest.errMsg||'网络异常，请稍后重试！！',
          icon: 'none',
          duration: 2000,
          mask:true
        })
      }
    })
    .catch(r => {
      console.error(r)
      wx.showToast({
        title: '网络异常，请稍后重试！',
        icon: 'none',
        duration: 2000,
        mask:true
      })
    })
  },

  cancelPopup(){
    this.hidePop()
  },

  okPopup(){
    this.hidePop()
    if(this.data.className!=''){
      this.setData({
        pageNo:1,
        dataList:[],
        totalPage:0,
        viewName:this.data.className
      })
      //this.getListData()
    }
  },


  allClass(){
    this.hidePop()
    this.setData({
      pageNo:1,
      dataList:[],
      totalPage:0,
      viewName:'全部班级',
      classKey:''
    })
    //this.getListData()
  },

  hidePop () {
    // 关闭select  .对应class #对应id
    this.selectComponent('#popup').hidePop()
  },
  //---------------------班级选择end


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: "发布跳绳任务"
    })
    var infos = options.info;
    
    // this.setData({
    //   //TODO UI注释
    //   isEdit:options.isEdit||0
    //   //isEdit:1
    // })
    console.log(this.data.isEdit+"==="+JSON.stringify(options))
    // if(infos == null){
      console.log("发布任务");
      this.showDate()
      this.getSchoolArea()
      this.setData({
        ifEdit:false
      })
    // }else{
    //   console.log("编辑作业");
    //   this.setData({
    //     ifEdit:true,
    //     pageData:JSON.parse(options.info)
    //   })
    //   this.setPageData();
    // }

    
   
    // if(this.data.isEdit == 1){
    //   console.log("发布作业");
    //   this.showDate()
    //   this.getSchoolArea()
    // }else{
    //   console.log("编辑作业");
    //   this.setData({
    //     pageData:JSON.parse(options.info)
    //   })
    //   setPageData();
    // }
    
  },

  //编辑作业数据设置
  setPageData(){
    var dataDetail = this.data.dataDetail;
    dataDetail.startTime = this.data.pageData.startTime; //开始时间
    dataDetail.classId = this.data.pageData.classId; //班级id 
    dataDetail.classType = this.data.pageData.classType; //班级id 
    dataDetail.describes = this.data.pageData.describes; //内容
    dataDetail.endTime = this.data.pageData.submitDate; // 结束时间
    dataDetail.fileUrl = this.data.pageData.fileUrl; //文件url:aaaa,bbbbb
    dataDetail.loopRule = this.data.pageData.loopRule; //规则:0只发布一次,1周内循环,2自定义
    dataDetail.nj = this.data.pageData.nj; //年级 

    if(this.data.pageData.pictureUrl!=null){
    
      dataDetail.pictureUrl = this.data.pageData.pictureUrl.join(','); //图片url:aaaa,bbbbb
    }
   


    dataDetail.reamrk = this.data.pageData.remark;//自定义天数:1;2;5
    dataDetail.schoolId = this.data.pageData.schoolId; //校区id 
    dataDetail.sectionId = this.data.pageData.sectionId; //学段id: 
    dataDetail.submitTime = this.data.pageData.submitTime; //提交截止天数 .
    dataDetail.title = this.data.pageData.title;  //标题   
    dataDetail.id = this.data.pageData.homeworkId; //作业id
    var vschoolArea = this.data.pageData.campusName;
    var vgradeName = this.data.pageData.sectionName+this.data.pageData.nj+"年级";
    var vclassName = this.data.pageData.className;

    this.setData({
      selectCycleAction:this.data.pageData.loopRemark,
      dataDetail:dataDetail,
      schoolArea:vschoolArea,
      gradeName:vgradeName,
      className:vclassName,
      
    })

    var dateCom =  this.selectComponent("#date-select");
    dateCom.onShowSingelAlert(this.data.pageData.startTime,'开始时间');
    //dateCom.onShowSingelAlert('2022-05-14 23:59:59','开始时间'); 测试代码


    var dateComEnd =  this.selectComponent("#date-select-end");
    dateComEnd.onShowSingelAlert(this.data.pageData.submitDate,'截止时间');


    if(this.data.pageData.pictureUrl!=null){
      console.log("======+str=="+JSON.stringify(this.data.pageData.pictureUrl.join(',')));
      var dataStr = this.data.pageData.pictureUrl.join(',');
      this.setData({
        imgDetailPics:dataStr.split(',')
      })
    }

  },

  showDate(){
    var dateCom =  this.selectComponent("#date-select");
    
    dateCom.onShowSingelAlert(null,'开始时间');

    var dateComEnd =  this.selectComponent("#date-select-end");

    dateComEnd.onShowSingelAlert(null,'截止时间');


    //发布时间初始值
    // var datail  = this.data.dataDetail
    // datail.startTime = value.detail  +' 00:00:00'
    // datail.endTime = value.detail+' 23:59:59'
    // this.setData({
    //   dataDetail:datail
    // })


    var defaultDay  =formatDateReal(new Date());
    defaultDay  = defaultDay.split(' ')[0]

    var datail  = this.data.dataDetail
    datail.ruleJson.type = 1
    datail.ruleJson.week = []
    datail.startTime = defaultDay  +' 00:00:00'
    datail.endTime = defaultDay+' 23:59:59'
    this.setData({
      dataDetail:datail,
      selectCycleAction:'只发布一次',
    })
    console.log('默认参数 == '+JSON.stringify(this.data.dataDetail))
  },
  actionSelectClass(){
    
  },

  showSelectClassAlert(){//选择学校班级
  	this.setData({
  		bottom: true
    })
    if(this.schoolArealist==null || this.schoolArealist.length<=0){
      this.getSchoolArea()
    }
    
  },
  showCycleSheet(){
    var action =  this.selectComponent("#cycle-sheet");
    action.onShowSingelAlert(this.data.cycleActionSheetItems,0);
  },

  //作业循环数据 loopRule、自定义 reamrk
  actionSheetData(data){
    console.log('循环规则回调'+JSON.stringify(data))
    var dt  = data.detail
    var val; 
    var dataDetail = this.data.dataDetail;
    val = dt.txt;
    if(dt&&dt.list){
      var list =dt.list||[];
      var str = [];
      var j = 0;
      for(var i=0;i<list.length;i++){
        var item  = list[i];
        if(item.isSelect==true){
          if(i==0){
            str[j] = item.value;
            val = item.txt;
          }else{
            str[j] = item.value;
            val = val+"、"+item.txt;
          }
          j++;
        }
      }
    }
    dataDetail.ruleJson.type = dt.value+1
    dataDetail.ruleJson.week = str
    console.log(val+'==循环规则回调2=='+dataDetail.ruleJson.type+" "+dataDetail.ruleJson.week)
    if(dataDetail.ruleJson.type == 1){
      this.setData({
        disabled:false,   
      })
          var dateComEnd =  this.selectComponent("#date-select-end");
    dateComEnd.onShowSingelAlert(formatDateReal(new Date()),'截止时间');
    }else{
      this.setData({
        disabled:true,   
      })
    }
      
    this.setData({
      selectCycleAction:val,
      dataDetail:dataDetail
    })
  },
  actionSheetTap:function(){
    this.setData({
     actionSheetHidden:!this.data.actionSheetHidden
    })
   },
   actionSheetbindchange:function(){
    this.setData({
     actionSheetHidden:!this.data.actionSheetHidden
    })
   },
   didClickActionShow(){
    var action =  this.selectComponent("#action-sheet");
    action.onShowSingelAlert(this.data.actionSheetItems,1);
  
   },

  didClickUp(){
    this.setData({
      isShowDetail:false
    })
  },

  //submitTime提交截止天数
  actionSheetIndex(e){
    var dataDetail = this.data.dataDetail;
    dataDetail.endTime = e.detail.value;
    this.setData({
      dataDetail:dataDetail
    })
  },

   //startTime提交开始时间
  titleDateStart(value){
    var datail  = this.data.dataDetail
    datail.startTime = value.detail  +' 00:00:00'
    this.setData({
      dataDetail:datail
    })
  },

  //endTime提交结束时间
  titleDateEnd(value){//结束时间
    if(this.data.dataDetail.ruleJson.type == 1){
      wx.showToast({
        title: '循环规则只发布一次不能选择截止时间',
        icon: 'none',
      })
    }else{
      var datail  = this.data.dataDetail
      datail.endTime = value.detail+' 23:59:59'
      this.setData({
        dataDetail:datail
      })
    }
    
  },

  didClickDown(){
    this.setData({
      isShowDetail:true
    })
  },

  //选择跳绳模式
  chooseMode1(){
      this.setData({
        chooseTaskMode:1
      })
  },
  chooseMode2(){
    this.setData({
      chooseTaskMode:12
    })
  },
  chooseMode3(){
    this.setData({
      chooseTaskMode:13
    })
  },

  //选择是否可补卡
  chooseRadioYes(){
    var datail  = this.data.dataDetail
    datail.afterClock = 1
    this.setData({
      dataDetail:datail,
      chooseYes:true,
      chooseNo:false
    })
  },

  chooseRadioNo(){
    var datail  = this.data.dataDetail
    datail.afterClock = 0
    this.setData({
      dataDetail:datail,
      chooseYes:false,
      chooseNo:true
    })
  },

  //提交作业
  submitData(){//提交数据

    if(!this.data.className){
      wx.showToast({
        title: '请选择班级！',
        icon: 'none',
      })
      return
    }

    if(!this.data.dataDetail.title||this.data.dataDetail.title.length<=0){
      wx.showToast({
        title: '请输入任务标题！',
        icon: 'none',

      })
      return
    }
    if(this.hasEmoji(this.data.dataDetail.title)){
      wx.showToast({
        title: '任务标题中不能有表情符号！',
        icon: 'none',
      })
      return
    }
    if(this.data.dataDetail.title.length>20){
      wx.showToast({
        title: '任务标题不能超过20个字！',
        icon: 'none',
      })
      return
    }
    // if(!this.data.schoolArea){
    //   wx.showToast({
    //     title: '请选择校区！',
    //     icon: 'none',
    //   })
    //   return
    // }

    // if(!this.data.gradeName){
    //   wx.showToast({
    //     title: '请选择年级！',
    //     icon: 'none',
    //   })
    //   return
    // }
  


    if(!this.data.dataDetail.describes){
      
      wx.showToast({
        title: '任务内容不能为空！',
        icon: 'none',
      })
      return
    }

    if(this.hasEmoji(this.data.dataDetail.describes)){
      wx.showToast({
        title: '任务内容有特殊符号！',
        icon: 'none',
      })
      return
    }
    if(this.data.dataDetail.describes.length>100){
      wx.showToast({
        title: '任务详情不能超过100个字！',
        icon: 'none',
      })
      return
    }

    if(!this.data.selectCycleAction){
      wx.showToast({
        title: '请选择循环规则！',
        icon: 'none',
      })
      return 
    }

    console.log(this.data.dataDetail.endTime+' =开始时间不能大于截止时间111==='+this.data.dataDetail.startTime)
    let endTime = Date.parse(this.data.dataDetail.endTime); 
    let startTime = Date.parse(this.data.dataDetail.startTime); 
    console.log(endTime+' =开始时间不能大于截止时间222==='+startTime)
    if(startTime > endTime){
      wx.showToast({
        title: '开始时间不能大于截止时间',
        icon: 'none',
      })
      return 
    }

    this.addTask()

    // if(!this.data.ifEdit){
    //   this.subMitFunction()
    // }else{
    //   this.editHomeWork()
    // }
    
  },
//提交任务
addTask(){
    var dataDetail = this.data.dataDetail
    dataDetail.subType = this.data.chooseTaskMode
    dataDetail.classId = this.data.classKey

  wx.showLoading({
    title: '加载中，请稍候...',
    duration:10000
  })
  console.log('接口参数='+JSON.stringify(dataDetail))
    app.api.addTask(dataDetail).then(rest => {
    wx.hideLoading()
    console.log('=queryTaskRopeList接口数据='+JSON.stringify(rest))
    if(rest&&rest.success){   
     
      wx.showToast({
        title: '提交成功！',
        success:function(){

          let pages = getCurrentPages();//当前页面
          let prevPage = pages[pages.length-2];//上一页面
          prevPage.setData({//直接给上移页面赋值
            isRefresh: 1
            
          });

          wx.navigateBack({
            delta: 1,  // 返回上一级页面。
            success: function() {           
            }
          })
        },
        icon: 'none',
        duration: 1500,
        mask:true
    })
    }else{
      wx.showToast({
        title: rest.errMsg,
        icon: 'none',
        duration: 1000,
        mask:true
    })
    }
  })

  },



  editHomeWork(){//提交函数
    var dataDetail = this.data.dataDetail
    dataDetail.schoolId =parseInt(this.data.schoolAreaKey)
    dataDetail.classType = parseInt(this.data.classTypesKey)
    dataDetail.nj = parseInt(this.data.gradeKey)
    dataDetail.classId = parseInt(this.data.classKey)
    var obj=dataDetail;
    for(var key in obj){
      if(obj[key] ==''){
        delete obj[key]
      }
    }
     //班级

  // var datile = {
  //     startTime:this.data.dataDetail.startTime,
  //     classId:'',
  //     classType:'',
  //     describes:'',
  //     endTime:this.data.dataDetail.startTime,
  //     fileUrl:'',
  //     id:'',
  //     loopRule:'',
  //     nj:'',
  //     pictureUrl:'',
  //     reamrk:'1',//自定义天数:1;2;5
  //     schoolId:'',
  //     sectionId:'',
  //     submitTime:'',
  //     teacherId:'',
  //     title:'',
  //     videoUrl:'',
  // }

wx.showLoading({
  title: '加载中，请稍候...',
  duration:10000
})
console.log('接口参数='+JSON.stringify(dataDetail))
  app.api.editHomeWork(dataDetail).then(rest => {
    wx.hideLoading()
    if(rest&&rest.success){   

      wx.showToast({
        title: '提交成功！',
        success:function(){
          wx.navigateBack({
            delta: 1,  // 返回上一级页面。
            success: function() {           
            }
          })
        },
        icon: 'none',
        duration: 1500,
        mask:true
    })
    }else{
      wx.showToast({
        title: rest.errMsg,
        icon: 'none',
        duration: 1000,
        mask:true
    })
    }
  })

  },

  //title 作业title
  worksTitleInput(value){
      var datail  = this.data.dataDetail
      datail.title = value.detail.value
      this.setData({
        dataDetail:datail
      })
  },

  //describes 作业describes
  worksDescInput(value){
    var datail  = this.data.dataDetail
    datail.describes = value.detail.value
    this.setData({
      dataDetail:datail
    })
  },
  

hasEmoji (value) {
    return /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig.test(value);
  },

    //监听组件事件，返回的结果
    //pictureUrl 作业图片
    myEventListener:function(e){
      console.log("pictureUrl=="+e.detail.picsList)
      // this.setData({
      //   imgDetailPics :e.detail.picsList
      // })
      // var list = e.detail.picsList||""
      // var str = list.split(",")
      var dataDetail = this.data.dataDetail;
      dataDetail.images = e.detail.picsList
      
      this.setData({
        dataDetail:dataDetail
      })
      console.log("上传的图片结果集合="+this.data.dataDetail.images)
      
     },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})